UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RYTxxDM1nCnv5g5fmWB+PEfA+3SZBMHYJP0GMpQ4ppw=' 
WHERE 
  key_id = '561683dc437095c8a38fa37f3671373d1994ab41123e8aedbe5dbfa81d76d512' 
  AND (
    token = 'RYTxxDM1nCnv5g5fmWB+PEfA+3SZBMHYJP0GMpQ4ppw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035