UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uk18JzAT84y7eCDWCqH1Fi+c16T+oPVula9CAly70g0=' 
WHERE 
  key_id = '4853e9e90713678d05771f50cab22f10ba56437bc2c2ca5d91c6115be9dc6696' 
  AND (
    token = 'Uk18JzAT84y7eCDWCqH1Fi+c16T+oPVula9CAly70g0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045