UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJh83drJmExY1wYIhQuTD8Uas1tCysZ4OJGS/AXbXXM=' 
WHERE 
  key_id = '8cf5186afc46b295649bce9bc61280ef31a061121f99c5885dd8668fce6dcbf9' 
  AND (
    token = 'cJh83drJmExY1wYIhQuTD8Uas1tCysZ4OJGS/AXbXXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032