UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYyhZNRq/CfPFyoK413/hVV1J5rg4dboPbe47Sh5rU0=' 
WHERE 
  key_id = '02a479abc053ade8b518e0069f23b589c8788bc84a1c3443078da19d7a938827' 
  AND (
    token = 'aYyhZNRq/CfPFyoK413/hVV1J5rg4dboPbe47Sh5rU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036