UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tw55znXf+q+XAt5RBQRR46SYPLvaUPnYYmOsW2/Ng2E=' 
WHERE 
  key_id = '2797b5b3d98cc7f67047cd9ba774e46a480190ad3f6fb0cb54436c259fbd46d8' 
  AND (
    token = 'tw55znXf+q+XAt5RBQRR46SYPLvaUPnYYmOsW2/Ng2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031