UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3n47gruhGYLOmVChSm1ZbsPUlrLHNHXQnJYOGh73vtQ=' 
WHERE 
  key_id = '9c38c6aa8a620881d0465b19d0a53bee7178aa3df867485d5cd8226893df535e' 
  AND (
    token = '3n47gruhGYLOmVChSm1ZbsPUlrLHNHXQnJYOGh73vtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035