UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3DL0/EbMTtueQXuPQBLvrfGj1V6tJfG/cK/KlAD+Bw=' 
WHERE 
  key_id = 'a8d0742884cf3b80d4e01328b02592888df8228c63bd6e229ae7e9d118276e12' 
  AND (
    token = 'h3DL0/EbMTtueQXuPQBLvrfGj1V6tJfG/cK/KlAD+Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077