UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dUJUQryrskWblAq/2ntBeYPtT7aTIcDXIbEH+XBWKDo=' 
WHERE 
  key_id = '386e31681b341e10b2bac2f17b785057f7fe0ec3c4b36012d978d20ffae82246' 
  AND (
    token = 'dUJUQryrskWblAq/2ntBeYPtT7aTIcDXIbEH+XBWKDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027