UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dJeHLz/3jbRQLJN1qlECe5WU4X/XRTViKegxL6ZPXcs=' 
WHERE 
  key_id = '18efc6fc7854bd96f5df180f283d59cde19d780c15862612f63f28e0bc8ed9e4' 
  AND (
    token = 'dJeHLz/3jbRQLJN1qlECe5WU4X/XRTViKegxL6ZPXcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029