UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bK/NpQzhzP9fCrq6B+tsggJvkviXFaalgqYbTLtjeOw=' 
WHERE 
  key_id = '9bec15c35fd44d51a39aeb4b8c684fa3d4cbda31856e89b96b55869afa49496e' 
  AND (
    token = 'bK/NpQzhzP9fCrq6B+tsggJvkviXFaalgqYbTLtjeOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037