UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gJTOFj0Ixzm+lNSWWvXS2zVsDq175ujbsokuPnnZNgQ=' 
WHERE 
  key_id = '16e0d332683cfc2505b71cb8fbf19d0178ae9d6d00842150ca16a2039010a6cd' 
  AND (
    token = 'gJTOFj0Ixzm+lNSWWvXS2zVsDq175ujbsokuPnnZNgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040