UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'flKkzD90aOkQLdGJYgl6dZ2REJSuJ0NY/csVufvwIu4=' 
WHERE 
  key_id = '974f5a28999471ae9ef9352352f9b060496aecd82bde90934c84bbd4dad4259b' 
  AND (
    token = 'flKkzD90aOkQLdGJYgl6dZ2REJSuJ0NY/csVufvwIu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040