UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vX/dEZvRTjG9U7LjVSoGG1fXHV3q6PG5FaFWXyOG2dw=' 
WHERE 
  key_id = '0b4868e41cdfdbe05417e38c9602ceeb88704dc5802056a82ed7e854faff09ea' 
  AND (
    token = 'vX/dEZvRTjG9U7LjVSoGG1fXHV3q6PG5FaFWXyOG2dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070