UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7odbviTzyja7axN0y1kZC2g/92uY9FPzXO8IZFV8HZY=' 
WHERE 
  key_id = 'e47f43a06d60e72e56b4f5acdeb1e0815dfe033816c4830b49a6c3598803183a' 
  AND (
    token = '7odbviTzyja7axN0y1kZC2g/92uY9FPzXO8IZFV8HZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024