UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pcygaimZGvIoVK+b6NYHjHFTGhMvLUHeJULoXBqiHSU=' 
WHERE 
  key_id = '612a7794870e01f3b88e10e6852ac4a7ed66b26b48238d12988254369fb9cd5b' 
  AND (
    token = 'pcygaimZGvIoVK+b6NYHjHFTGhMvLUHeJULoXBqiHSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027