UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vXAG+xe8Yx4+RUI6QMnAPT7+U/QyAeuWGwLZY513Rlw=' 
WHERE 
  key_id = '19a72df31f25d0b622d035e1181233585aea6dece2c1351c1289e3179f00df22' 
  AND (
    token = 'vXAG+xe8Yx4+RUI6QMnAPT7+U/QyAeuWGwLZY513Rlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029