UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'McrLWHUkGT59LsDLKkp30oB6r6MXuNUs9OgNV9w+q5Q=' 
WHERE 
  key_id = '1303eed455bb0bb16292cd82b38015e93977438f6810410b114198fb48a5de5e' 
  AND (
    token = 'McrLWHUkGT59LsDLKkp30oB6r6MXuNUs9OgNV9w+q5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040