UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ljZJvFcQloj1cNyKPRo3zB6TdcSbW8ccUFSF7tKo04w=' 
WHERE 
  key_id = '1a95d725854865978abc567c30c8dfc701cc8a4b0304b01249f5a43156a85f3b' 
  AND (
    token = 'ljZJvFcQloj1cNyKPRo3zB6TdcSbW8ccUFSF7tKo04w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051