UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8P+TeU57YIbNvc0Oid2VnuQBvIW9gLzbnIWZNLwTomg=' 
WHERE 
  key_id = 'c4f1d59e3dd15b780661e3d5e9028ab56236c00f6c90cb996ca7b04b0f8db152' 
  AND (
    token = '8P+TeU57YIbNvc0Oid2VnuQBvIW9gLzbnIWZNLwTomg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040